﻿@model List<PhoneBilling.UIAccount>
@{
    ViewBag.Title = "原始话单查询";
    Layout = null;
}
<div id="maingrid"></div>
@*@{
    var grid = new WebGrid(source: Model,canPage: false);
}
@grid.GetHtml(
    alternatingRowStyle: "bg",
    columns:grid.Columns
    (
        grid.Column("部门","部门"),
        grid.Column("分组", "分组"),
        grid.Column("分机号码","分机号码"),
        grid.Column("月租费","月租费"),
        grid.Column("功能费","功能费"),
        grid.Column("维护费","维护费"),
        grid.Column("其他费", "其他费"),
        grid.Column("月杂费","月杂费"),
        grid.Column("内线计次","内线计次"),
        grid.Column("内线金额","内线金额"),
        grid.Column("市话计次","市话计次"),
        grid.Column("市话金额","市话金额"),
        grid.Column("郊县计次","郊县计次"),
        grid.Column("郊县金额","郊县金额"),
        grid.Column("IP计次","IP计次"),
        grid.Column("IP金额","IP金额"),
        grid.Column("信息计次","信息计次"),
        grid.Column("信息金额","信息金额"),
        grid.Column("专线计次","专线计次"),
        grid.Column("专线金额","专线金额"),
        grid.Column("国内计次","国内计次"),
        grid.Column("国内金额","国内金额"),
        grid.Column("国际计次","国际计次"),
        grid.Column("国际金额","国际金额"),
        grid.Column("其他计次","其他计次"),
        grid.Column("其他金额","其他金额"),
        grid.Column("话单总次数","话单总次数"),
        grid.Column("免费额","免费额"),
        grid.Column("话单总金额","话单总金额")
    )
)
*@
@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},",Model.Count));
    sb.AppendLine("Rows:[");
    for(int i =0;i < Model.Count;i++)
    {
        var item = Model[i];
        if(i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("部门:'{0}',", item.部门));
        sb.Append(string.Format("分组:'{0}',",item.分组));
        sb.Append(string.Format("分机号码:'{0}',",item.分机号码));
        sb.Append(string.Format("月份:'{0}',",item.月));
        sb.Append(string.Format("月租费:'{0}',",item.月租费));
        sb.Append(string.Format("功能费:'{0}',",item.功能费));
        sb.Append(string.Format("维护费:'{0}',", item.维护费));
        sb.Append(string.Format("其他费:'{0}',", item.其他费));
        sb.Append(string.Format("月杂费:'{0}',", item.月杂费));
        sb.Append(string.Format("内线计次:'{0}',", item.内线计次));
        sb.Append(string.Format("内线金额:'{0}',", item.内线金额));
        sb.Append(string.Format("市话计次:'{0}',", item.市话计次));
        sb.Append(string.Format("市话金额:'{0}',", item.市话金额));
        sb.Append(string.Format("郊县计次:'{0}',", item.郊县计次));
        sb.Append(string.Format("郊县金额:'{0}',", item.郊县金额));
        sb.Append(string.Format("IP计次:'{0}',", item.IP计次));
        sb.Append(string.Format("IP金额:'{0}',", item.IP金额));
        sb.Append(string.Format("信息计次:'{0}',", item.信息计次));
        sb.Append(string.Format("信息金额:'{0}',", item.信息金额));
        sb.Append(string.Format("专线计次:'{0}',", item.专线计次));
        sb.Append(string.Format("专线金额:'{0}',", item.专线金额));
        sb.Append(string.Format("国内计次:'{0}',", item.国内计次));
        sb.Append(string.Format("国内金额:'{0}',", item.国内金额));
        sb.Append(string.Format("国际计次:'{0}',", item.国际计次));
        sb.Append(string.Format("国际金额:'{0}',", item.国际金额));
        sb.Append(string.Format("其他计次:'{0}',", item.其他计次));
        sb.Append(string.Format("其他金额:'{0}',", item.其他金额));
        sb.Append(string.Format("免费额:'{0}',", item.免费额));
        sb.Append(string.Format("话单总次数:'{0}',", item.话单总次数));
        sb.Append(string.Format("话单总金额:'{0}'", item.话单总金额));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    var grid;
    $(function () {

        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '部门', name: '部门',width:80},
                { display: '分组', name: '分组',width:80},
                { display: '分机号码', name: '分机号码',width:80},
                { display: '月份', name: '月份',width:80},
                { display: '月租费', name: '月租费',width:80},
                { display: '功能费', name: '功能费',width:80},
                { display: '维护费', name: '维护费',width:80},
                { display: '其他费', name: '其他费',width:80},
                { display: '月杂费', name: '月杂费',width:80},
                { display: '内线计次', name: '内线计次',width:80},
                { display: '内线金额', name: '内线金额',width:80},
                { display: '市话计次', name: '市话计次',width:80},
                { display: '市话金额', name: '市话金额',width:80},
                { display: '郊县计次', name: '郊县计次',width:80},
                { display: '郊县金额', name: '郊县金额',width:80},
                { display: 'IP计次', name: 'IP计次',width:80},
                { display: 'IP金额', name: 'IP金额',width:80},
                { display: '信息计次', name: '信息计次',width:80},
                { display: '信息金额', name: '信息金额',width:80},
                { display: '专线计次', name: '专线计次',width:80},
                { display: '专线金额', name: '专线金额',width:80},
                { display: '国内计次', name: '国内计次',width:80},
                { display: '国内金额', name: '国内金额',width:80},
                { display: '国际计次', name: '国际计次',width:80},
                { display: '国际金额', name: '国际金额',width:80},
                { display: '其他计次', name: '其他计次',width:80},
                { display: '其他金额', name: '其他金额',width:80},
                { display: '通话次数', name: '话单总次数',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>总通话次数:' + suminf.max + '</div>';                        }}},
                { display: '免费额', name: '免费额',width:80},
                { display: '总金额', name: '话单总金额',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>总金额:' + suminf.max + '</div>';                        }}}],
                isScroll: false, data: data,pageSize:30,alternatingRow:true
        }
        );resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });</script>